package com.ruoyi.web.controller.newTable;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TExpenditureUp;
import com.ruoyi.system.service.ITExpenditureUpService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 纵向、横向到校科研经费数_上Controller
 * 
 * @author ruoyi
 * @date 2024-12-07
 */
@RestController
@RequestMapping("/system/up")
public class TExpenditureUpController extends BaseController
{
    @Autowired
    private ITExpenditureUpService tExpenditureUpService;

    /**
     * 查询纵向、横向到校科研经费数_上列表
     */
    @PreAuthorize("@ss.hasPermi('system:up:list')")
    @GetMapping("/list")
    public TableDataInfo list(TExpenditureUp tExpenditureUp)
    {
        startPage();
        List<TExpenditureUp> list = tExpenditureUpService.selectTExpenditureUpList(tExpenditureUp);
        return getDataTable(list);
    }

    /**
     * 导出纵向、横向到校科研经费数_上列表
     */
    @PreAuthorize("@ss.hasPermi('system:up:export')")
    @Log(title = "纵向、横向到校科研经费数_上", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TExpenditureUp tExpenditureUp)
    {
        List<TExpenditureUp> list = tExpenditureUpService.selectTExpenditureUpList(tExpenditureUp);
        ExcelUtil<TExpenditureUp> util = new ExcelUtil<TExpenditureUp>(TExpenditureUp.class);
        util.exportExcel(response, list, "纵向、横向到校科研经费数_上数据");
    }

    /**
     * 获取纵向、横向到校科研经费数_上详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:up:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tExpenditureUpService.selectTExpenditureUpById(id));
    }

    /**
     * 新增纵向、横向到校科研经费数_上
     */
    @PreAuthorize("@ss.hasPermi('system:up:add')")
    @Log(title = "纵向、横向到校科研经费数_上", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TExpenditureUp tExpenditureUp)
    {
        return toAjax(tExpenditureUpService.insertTExpenditureUp(tExpenditureUp));
    }

    /**
     * 修改纵向、横向到校科研经费数_上
     */
    @PreAuthorize("@ss.hasPermi('system:up:edit')")
    @Log(title = "纵向、横向到校科研经费数_上", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TExpenditureUp tExpenditureUp)
    {
        return toAjax(tExpenditureUpService.updateTExpenditureUp(tExpenditureUp));
    }

    /**
     * 删除纵向、横向到校科研经费数_上
     */
    @PreAuthorize("@ss.hasPermi('system:up:remove')")
    @Log(title = "纵向、横向到校科研经费数_上", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tExpenditureUpService.deleteTExpenditureUpByIds(ids));
    }
}
